<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="org.limp.mine.StringTool"%> 
<%@ page import="org.limp.mine.Label"%>
<%@ page import="org.limp.mine.Controller"%>	
<%@ page import="org.limp.mine.DateTrimmer"%>
<% 
    String context = jt.classic.system.ISystem.getContextPath();
	Object[] result = (Object[])request.getAttribute("result");	
	Label label = (Label)result[1];
	Controller controller = (Controller)result[2];	
	String pageNO = (String)result[3];
	List resultList = (List) result[0];
	
	String v_clxx_pzh = (String)request.getAttribute("v_clxx_pzh");//牌照号
	String v_clxx_cp = (String)request.getAttribute("v_clxx_cp");//厂牌
	
	String index = (String)request.getAttribute("index");//动态添加车辆序号
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<jsp:include page="../../head.jsp"></jsp:include> 
<script language="javascript">
  var chk = false;
  function checkall(thizz){
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox"){
        chks[i].checked = !chk;
      }
    }
    
    chk = !chk;
  }
  
  function handleDelete(){
    var rnt = false;
    var ids = "";
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox" && chks[i].checked){
        rnt = true;
        ids += chks[i].value + ",";
      }
    }
    
    if(!rnt){
      alert("请选择要删除的驾驶员");
    }else if(confirm("确定删除")){
      createHidden("ids",ids.substring(0,ids.length - 1));
      document.form1.action = "<%=context%>/app/clxx.do?method=delete";
      document.form1.submit();
    }
  }
  
  function handleQuery(){
    document.form1.action = context + "/app/clxx.do?method=list&type=select&index=<%=index%>";
    document.form1.submit();
  }
  
  function handleInsert(){
      var url = "<%=context%>/app/clxx.do?method=neu";
      window.location.href = url;
  }
  
  function handleEdit(id){
      var url = "<%=context%>/app/clxx.do?method=edit&id=" + id;
      window.location.href = url;
  }  
   
  function handleReresh(){
      window.location.href = context + "/app/clxx.do?method=list&pageNO=<%=pageNO%>&type=select&index=<%=index%>";
  }
  /**
  * 添加车辆
  */
  function handleSelect(){
  var rnt = false;
    var ids = "";
    var names = "";
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "radio" && chks[i].checked&&chks[i].value!=""){
        rnt = true;
        ids += chks[i].value;
        
        names += document.getElementById(chks[i].value).value;
        break;
      }
    }
   
    if(ids!=""){
    	addobj(ids,names,document.getElementById("index").value);
    	parent.closeDialog();
    }else{
       alert("请选择车辆！");
    }
  }
  
   /**
   *向父窗口添加车辆
   */
    function addobj(id,name,index){
     var clxx_id = window.parent.document.getElementById("clxx_id"+index);
     var clxx_name = window.parent.document.getElementById("clxx_name"+index);
     clxx_id.value = id;
     clxx_name.value = name;
     } 
</script>
<body>
<form name="form1" method="post" action="">
<input type="hidden" name="pageNO" value="<%=pageNO%>" />
<input type="hidden" name="index" id="index" value="<%=index%>" />
牌照号 <input type="text" class="box3" name="v_clxx_pzh" value="<%=v_clxx_pzh%>">
       厂牌 <input type="text" class="box3" name="v_clxx_cp" value="<%=v_clxx_cp%>">
      <img src="/app/info/images/search.png" title="查询" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleQuery();"/>查 询
      <img src="/app/info/images/addinfo.png" title="新增车辆信息" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleSelect();"/>确 定
<table class="tbl" border="0" width="98%" cellspacing="0" cellpadding="0">
  <thead>
  <tr class="tr0" bgcolor="#A7CADE"> 
    <td title="全部选择/取消选择" onclick="javascript:checkall();" width="10" align="center">&nbsp;</td>
    <td  width="25%">&nbsp;牌照号</td>
    <td  width="15%">&nbsp;车型</td>
    <!--
    <td  width="15%">&nbsp;驾驶人</td>
    -->
    <td  width="20%">&nbsp;初次登记时间</td>
    <td  width="20%">&nbsp;下次检验日期</td>
  </tr>
  </thead>
  <% 
    if(resultList!=null&&!resultList.isEmpty()){
    
       for(int i=0;i<resultList.size();i++){
	       Map info = (Map)resultList.get(i);
	       String number = (String)info.get("PAGINATION_NUMBER");
	       
			String clxx_id = StringTool.checkString(info.get("CLXX_ID"));//ID
			String clxx_pzh = StringTool.checkString(info.get("CLXX_PZH"));//牌照号
			String clxx_cx = StringTool.checkString(info.get("CLXX_CX"));//车型
			String clxx_cp = StringTool.checkString(info.get("CLXX_CP"));//厂牌
			String clxx_ys = StringTool.checkString(info.get("CLXX_YS"));//颜色
			String clxx_fdjh = StringTool.checkString(info.get("CLXX_FDJH"));//发动机号
			String clxx_cjh = StringTool.checkString(info.get("CLXX_CJH"));//车架号
			//String clxx_jsr = StringTool.checkString(info.get("CLXX_JSR"));//驾驶人
			String clxx_ccdjsj = StringTool.checkString(info.get("CLXX_CCDJSJ"));//初次登记时间
			String clxx_xcjrrq = StringTool.checkString(info.get("CLXX_XCJRRQ"));//下次检验日期
			String clxx_bz = StringTool.checkString(info.get("CLXX_BZ"));//备注
  
  %> 
  <tr> 
    <td class="td1" align="center">
    <input type="radio" name=chk id="chk_<%=clxx_id%>" value="<%=clxx_id%>"  />
    <input type=hidden id="<%=clxx_id%>" value="<%=clxx_pzh%>" />
    </td>
    <td class="td1">&nbsp;<a href="javascript:void(0);" onclick="javascript:handleView('<%=clxx_id%>');"><%=clxx_pzh%></a></td>
    <td class="td1">&nbsp;<%=clxx_cx%></td>
    <td class="td1">&nbsp;<%=clxx_ccdjsj%></td>
    <td class="td1">&nbsp;<%=clxx_xcjrrq%></td>
  </tr>
  <%
        }
     }
  %>
</table> 
<table width="98%" class="tab-noborder" border="0" cellspacing="0" cellpadding="0">
  <tr>
   <td>
    <%=label.displayLabel()%>
   </td>
   <td align="right">
        <%=label.startLabel()%>
        <%=label.previousLabel()%>
        <%=label.nextLabel()%>
        <%=label.endLabel()%>
        <%=controller.getController().toString()%>
    </td>
  </tr>
</table>  
<%=controller.getControlScript(true)%> 
</form>
</body>
</html>	